package com.alexeyhanin.tapestry.goodies.util.select;

import org.apache.tapestry5.ioc.services.PropertyAccess;
import org.apache.tapestry5.ioc.services.ClassPropertyAdapter;

/**
 * @author aha
 * @since 2009.30.11
 *        $Id: SimplePropertyAdapter.java 15 2009-11-30 17:52:21Z gagarin61 $
 */
public class SimplePropertyAdapter implements PropertyAdapter<String> {

    private org.apache.tapestry5.ioc.services.PropertyAdapter propertyAdapter;

    public SimplePropertyAdapter(String property, Class<?> clazz, PropertyAccess propertyAccess) {
        final ClassPropertyAdapter adapter = propertyAccess.getAdapter(clazz);
        propertyAdapter = adapter.getPropertyAdapter(property);
    }

    public String get(Object object) {
        return (String) propertyAdapter.get(object);
    }
}
